#ifndef NSI_SPIKE_UTIL_SIGNAL_BASE_H
#define NSI_SPIKE_UTIL_SIGNAL_BASE_H

#include <signal.h>

namespace nsi {
namespace spike {

class signal_base
{
public:

  // Signal action type
  typedef struct sigaction action_type;
  typedef siginfo_t signal_info_type;

  // Default constructor
  explicit signal_base();

  // Copy constructor
  signal_base(const signal_base& other);

  // Destructor
  virtual ~signal_base();

  // Assignment operator
  signal_base& operator=(const signal_base& other);

  // Operator which handles the signal
  virtual bool operator()(signal_info_type* info, void* ucontext);

  // Accessors
  const action_type& action() const
  {
    return action_;
  }

protected:
 
  // Sets the signal to be the current signal value
  bool current_signal(int value);

  // Signals action
  action_type action_;
};

} // namespace spike
} // namespace nsi

#endif // !NSI_SPIKE_UTIL_SIGNAL_BASE_H
